package es.deusto.pfc.garuda.server;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DAO
{
	private Connection connection;
	
	public DAO(String dbdriver, String dburl, String dbuser, String dbpasswd)
	{
		super();
		try
		{
			Class.forName(dbdriver);
			this.connection = DriverManager.getConnection(dburl, dbuser, dbpasswd);
		}
		catch (ClassNotFoundException e)
		{
			e.printStackTrace();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
	
	public void close()
	{
		try
		{
			Thread.sleep(2000);
			connection.close();
		}
		catch (InterruptedException e)
		{
			e.printStackTrace();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
}
